<?php
require_once './templates/header.php';
require './lib/ConnectDB.php';
if ($_SESSION['is_login'] != 1) {
    header("Location:index.php");
}
$connect = ConnectDB::getInstace();
        $result = $connect->cDB()->query('SELECT id_img,img_path FROM images WHERE id_user='.$_SESSION['id_user'].'');
?>
<section>
    <div id="uplad_menu">
        <span class="erorr"><?php if(!empty($_SESSION['erorr'])){ echo $_SESSION['erorr']; unset($_SESSION['erorr']); }?></span>
        <b>Качване на снимка</b>
        <form action="upload_photo.php" method="post" enctype="multipart/form-data">
            <label for="file">Изберете снимка:</label>
            <input type="file" name="file" class="buttons" id="file"><br>
            <b>Описание за снимката</b><br/>
            <textarea rows="4" cols="50" name="txtarea"></textarea><br/>
            <input type="submit" class="buttons" name="submit" value="Качване">
        </form>
    </div>
    <div id="album">
       
        <div id="container">
            
        <?php 
        if($result !=null){
        while ($img_r = $result->fetch_assoc()){
        ?>
            
              
            <a href="viewimg.php?id=<?php echo $img_r['id_img'];?>"  class="example-image-link"><img class="example-image" src="<?php echo 'img'.DIRECTORY_SEPARATOR.$_SESSION['name'].DIRECTORY_SEPARATOR.$img_r['img_path'];?>" height="150" width="150"></a>
             
               
               
               
               
           
        <?php }}?>
             
     </div>
    </div>
</section>

<?php require_once './templates/footer.php'; ?>